package com.zixue.heima.helloNetty.EventLoopGroopDemo;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName : ByteBufDemo
 * @Description : TODO
 * @Author : chunxiong
 * @Date : 2025/5/11 01:12
 * @Version 1.0
 */
@Slf4j
public class ByteBufDemo {
    public static void main(String[] args) {
        ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer();
        log.debug("buffer:"+buffer);
        //初始大小256  动态2被扩容， 比nio ByteBufFer强
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < 300; i++) {
            stringBuffer.append("a");
        }
        buffer.writeBytes(stringBuffer.toString().getBytes());
        log.debug("buffer:"+buffer);

    }
}
